import {reactive, ref, Ref} from "vue";
import axios from '@/utils/axios';


class PaverInfo{
    deviceId:number|null = null
    width:number|null = null

}


export default ()=>{
    const paverViewInfo = ref({
        showModal: false
    })

    const paverInfo = <Ref<PaverInfo>>ref({
        deviceId: null,
        width: null,

    })

    // 查找详细信息
    const getPaverInfo = (deviceId:number,callback:Function|null = null)=>{
        paverInfo.value.deviceId = deviceId
        axios.post("/pave/findDeviceParameterByDeviceId",{deviceId:deviceId}).then((res:any)=>{
            console.log(JSON.stringify(res))
            if(res.success)
                Object.assign(paverInfo.value,res.data)
            console.log(paverInfo.value)

            if(callback) callback()
        })
    }




    return {
        paverViewInfo,
        paverInfo,
        getPaverInfo,

    }
}